package cn.apthink.calendar;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Department {
	private String id;
	private String pid;
	private int worker;
	private double efficiency;
	
	public Department(String id, String pid, int worker) {
		this.id=id;
		this.pid = pid;
		this.worker = worker;
		this.efficiency = 1.0;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Department other = (Department) obj;
		return Objects.equals(id, other.id);
	}

	@Override
	public int hashCode() {
		return Objects.hash(id);
	}

	public static List<Department> testDatas() {
		List<Department> ls = new ArrayList<Department>();
		ls.add(new Department("factory", null, 5));
		ls.add(new Department("floor", "factory", 5));
		ls.add(new Department("l1", "floor", 2));
		ls.add(new Department("l2", "floor", 1));
		ls.add(new Department("l3", "floor", 2));
		return ls;
	}

}
